import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
import '../public/index.css'
import router from './router'
import store from './store/index'
import axios from './api/default-axios'
Vue.config.productionTip = false
Vue.prototype.$axios = axios
Vue.use(ElementUI);

var vm1 = new Vue({
  axios,
  store,
  router,
  render: h => h(App),
}).$mount('#app')
router.beforeEach((from,to,next)=>{
  console.log(from);
  if(from.path == '/Custom/list'){
    let personPower = JSON.parse(localStorage.getItem('name')).power;
    if(personPower === 'admin'){
      next();
    }else{
      vm1.$message("您没有这个权限哦",'error');
    }
  }else{
    next();
  }
    
})